﻿
@model EmailEntity
@{
    ViewData["Title"] = "邮件管理 编辑";
    Layout = "../Shared/_Layout.cshtml";
}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content text-center p-md">
                    <form id="dynamic-form" asp-action="Edit" method="post" class="form-horizontal" role="form">
                        <div asp-validation-summary="@ValidationSummary.All" class="text-danger"></div>

                        <input type="hidden" asp-for="EmailId" />
                        <input type="hidden" asp-for="FormId" />
                        <input type="hidden" asp-for="UserId" />
                        <div class="form-group">
                            <label asp-for="FormType" class="col-md-3 control-label text-right"> 类别</label>
                            <div class="col-md-9  text-left">
                                <div class="input-group m-b">
                                    <span class="input-group-addon">*</span>
                                    <select class="select2" asp-for="FormType">
                                        @{
                                            var enumlst = ConvertHelper.ToEnumList(typeof(NotifyTypeEnum), false);
                                            if (enumlst != null && enumlst.Count > 0)
                                            {
                                                foreach (var item in enumlst)
                                                {
                                                    @Html.Raw("<option "+(item.Key == Model.FormType ? "selected" : "")+" value='"+item.Key+"' >"+item.Value+"</option>")
                                                }
                                            }
                                        }
                                    </select>
                                </div>
                                <span asp-validation-for="FormType" class="text-danger"></span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label asp-for="SenderUser" class="col-md-3 control-label text-right"> 发送人</label>
                            <div class="col-md-9  text-left">
                                <div class="input-group m-b">
                                    <span class="input-group-addon">*</span>
                                    <input asp-for="SenderUser" class="form-control" validate="{required:true ,maxlength:200   }" />
                                </div>
                                <span asp-validation-for="SenderUser" class="text-danger"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label asp-for="SendDate" class="col-md-3 control-label text-right"> 发送时间</label>
                            <div class="col-md-9  text-left">
                                <div class="input-group m-b">
                                    <span class="input-group-addon">*</span>
                                    <input id="SendDate" name="SendDate" value="@(Model.SendDate != null?Model.SendDate.ToString("yyyy-MM-dd"):"")" class="form-control" validate="{required:true ,IsDate:true ,maxlength:23   }" />
                                </div>
                                <span asp-validation-for="SendDate" class="text-danger"></span>
                            </div>
                        </div>
                        <div class="form-group">

                            <label asp-for="ToUser" class="col-md-3 control-label text-right"> 接收人</label>
                            <div class="col-md-9  text-left">
                                <div class="input-group m-b">
                                    <span class="input-group-addon">*</span>
                                    <textarea asp-for="ToUser" validate="{required:true ,maxlength:3000   }" style="width:100%;" rows="3"></textarea>
                                </div>
                                <span asp-validation-for="ToUser" class="text-danger"></span>
                            </div>
                        </div>


                        <div class="form-group">

                            <label asp-for="CCUser" class="col-md-3 control-label text-right"> 抄送人</label>
                            <div class="col-md-9  text-left">

                                <textarea asp-for="CCUser" validate="{required:false ,maxlength:3000   }" style="width:100%" rows="3"></textarea>

                                <span asp-validation-for="CCUser" class="text-danger"></span>
                            </div>
                        </div>


                        <div class="form-group">

                            <label asp-for="Title" class="col-md-3 control-label text-right"> 标题</label>
                            <div class="col-md-9  text-left">
                                <div class="input-group m-b">
                                    <span class="input-group-addon">*</span>
                                    <input asp-for="Title" class="form-control" validate="{required:true ,maxlength:3000   }" />
                                </div>
                                <span asp-validation-for="Title" class="text-danger"></span>
                            </div>

                        </div>


                        <div class="form-group">

                            <label asp-for="Content" class="col-md-3 control-label text-right"> 内容</label>
                            <div class="col-md-9  text-left">

                                <textarea asp-for="Content" tabindex="4" class="summernote" style="width:100%;height:200px;"></textarea>
                                <span asp-validation-for="Content" class="text-danger"></span>
                            </div>

                        </div>


                        <div class="form-group">

                            <label asp-for="Status" class="col-md-3 control-label text-right"> 状态</label>
                            <div class="col-md-9  text-left">
                                <div class="input-group m-b">
                                    <span class="input-group-addon">*</span>
                                    <input asp-for="Status" class="form-control" validate="{required:true ,IsInt:true    }" />
                                </div>
                                <span asp-validation-for="Status" class="text-danger"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label asp-for="SendRound" class="col-md-3 control-label text-right"> 发送次数</label>
                            <div class="col-md-9  text-left">
                                <div class="input-group m-b">
                                    <span class="input-group-addon">*</span>
                                    <input asp-for="SendRound" class="form-control" validate="{required:true ,IsInt:true    }" />
                                </div>
                                <span asp-validation-for="SendRound" class="text-danger"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label asp-for="ExpireTime" class="col-md-3 control-label text-right">执行时间</label>
                            <div class="col-md-9  text-left">
                                <div class="input-group m-b">
                                    <span class="input-group-addon"></span>
                                    <input id="ExpireTime" name="ExpireTime" value="@(Model.ExpireTime != null?Model.ExpireTime.Value.ToString("yyyy-MM-dd"):"")" class="form-control" validate="{required:false ,IsDate:true ,maxlength:23   }" />
                                </div>
                                <span asp-validation-for="ExpireTime" class="text-danger"></span>
                            </div>
                        </div>


                        <div class="form-group">

                            <label asp-for="SendResult" class="col-md-3 control-label text-right"> 反馈结果</label>
                            <div class="col-md-9  text-left">

                                <textarea asp-for="SendResult" tabindex="11" style="width:100%;height:200px;"></textarea>

                                <span asp-validation-for="SendResult" class="text-danger"></span>
                            </div>
                        </div>


                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <a class="btn btn-white" asp-action="index">返  回</a>


                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

@section scripts{
    <script type="text/javascript">
        $(function () {
            $(document).ready(function () {
                $(".form-horizontal").CustomForm({
                    isValidate: true,
                    isTable: false
                });
                $(".form-horizontal").submit(function () {
                    if (!$(".form-horizontal").valid()) {
                        return false;
                    }
                });
            });
        });
    </script>
}